<!DOCTYPE html>
<title>Child test for escape-bad-characters.html</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>

// NOTE: This test should only be run by escape-bad-characters.html.

// Send output to parent test when done.
window.onload = function() {
  var data = {
    type: 'child_test_done',
    result: document.body.textContent
  };
  window.parent.postMessage(data, '*');
};

// Disable notifyDone otherwise parent test will be cancelled early.
if (self.testRunner) {
  self.testRunner.notifyDone = function() {}
}

test(function() {
  assert_true(true);
}, 'Unescaped \r carriage returns \r in test name.\r\n');

test(function() {
  assert_true(true);
}, 'Unescaped \0 null characters \0 in test name.\0');

test(function() {
  throw new Error('Test message \r with unescaped \r carriage returns.\r\n');
}, 'Unescaped carriage returns in test message.');

test(function() {
  throw new Error('Test message \0 with unescaped \0 null characters.\0');
}, 'Unescaped null characters in test message.');

</script>
